
function sleep(time){
  return new Promise((resolve,reject)=>{
    time += 1;
    setTimeout(function(){
      if (time < 0) {
        reject(new Error(must > 0));
      }
      else {
        resolve(time);
      }
    },time);
  })
}

async function test() {
  try {
    var r1 = await sleep(2000);
    var r2 = await sleep(1000);
  } catch (e) {
    console.log("have a error!");
  }
   console.log(r1);
   console.log(r2);
}

 test();
